<?php
class PurposeDao {
	private $table = 'purpose';
	public function get($id){
		return ClassManager::getSql()->oneDataCache($this->table, 'id',intval($id));
	}
	public function getListByFatherId($fatherId){
		return ClassManager::getSql()->datalist($this->table,"*","where father_id=".intval($fatherId));
	}
	public function getAllChildList(){
		return ClassManager::getSql()->datalist($this->table,"*"," where father_id!=0 ");
	}

	public function getByFatherId($fatherId){
		return ClassManager::getSql()->oneDataCache($this->table, 'father_id', intval($fatherId));
	}
	public function add($data){
		ClassManager::getSql()->insert($this->table, $data);
	}
	public function update($data,$id){
		ClassManager::getSql()->updates($this->table, $data,"where id=".intval($id));
	}
	public function deleteBatchByid($id){
		ClassManager::getSql()->delete($this->table,"where id in(".$id.")");
	}

}
?>